package com.lantosec.hmrp.modules.monitor.controller;


import com.lantosec.hmrp.core.kit.Result;
import com.lantosec.hmrp.core.mvc.BaseController;
import com.lantosec.hmrp.modules.monitor.entity.SatisfactionEntity;
import com.lantosec.hmrp.modules.monitor.service.IMonitorSatisfactionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 * 患者满意度 控制器
 *
 * @author AutoCode
 * @since 2020-05-27
 */
@Api(value = "大屏患者满意度控制器", tags = "大屏患者满意度控制器")
@RestController
@RequestMapping("/monitor/evaluation")
@Log4j2
public class MonitorSatisfactionController extends BaseController {
    @Autowired
    private IMonitorSatisfactionService service;

    @GetMapping("getServiceUnitsTotal")
    @ApiOperation(value = "服务单元满意度汇总")
    public Result<List<SatisfactionEntity>> getWarningTotal(
            @ApiParam(value = "月份") @RequestParam(name = "month",required = false) String month,
            @ApiParam(value = "年份") @RequestParam(name = "year",required = false) String year){
        List<SatisfactionEntity> total = service.getServiceUnitsTotal(month,year);
        return Result.ok(total);
    }

    @GetMapping("getServiceUnitsDetails")
    @ApiOperation(value = "服务单元满意度明细")
    public Result<List<SatisfactionEntity>> getServiceUnitsDetails(
            @ApiParam(value = "月份") @RequestParam(name = "month",required = false) String month,
            @ApiParam(value = "年份") @RequestParam(name = "year",required = false) String year,
            @ApiParam(value = "科室id") @RequestParam(name = "orgId") String orgId){
        List<SatisfactionEntity> total = service.getServiceUnitsDetails(month,year,orgId);
        return Result.ok(total);
    }

    @GetMapping("getServiceWindowTotal")
    @ApiOperation(value = "服务窗口满意度汇总")
    public Result<List<SatisfactionEntity>> getServicewindowTotal(
            @ApiParam(value = "月份") @RequestParam(name = "month",required = false) String month,
            @ApiParam(value = "年份") @RequestParam(name = "year",required = false) String year){
        List<SatisfactionEntity> total = service.getServiceWindowTotal(month,year);
        return Result.ok(total);
    }

    @GetMapping("getServiceWindowDetails")
    @ApiOperation(value = "服务窗口满意度明细")
    public Result<List<SatisfactionEntity>> getServiceWindowDetails(
            @ApiParam(value = "月份") @RequestParam(name = "month",required = false) String month,
            @ApiParam(value = "年份") @RequestParam(name = "year",required = false) String year,
            @ApiParam(value = "科室id") @RequestParam(name = "userId") String userId){
        List<SatisfactionEntity> total = service.getServiceWindowDetails(month,year,userId);
        return Result.ok(total);
    }

}
